package com.LittleHan.crm.exceptionHandler;

import com.LittleHan.crm.exception.ActivityCreateException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ActivityCreateExceptionHandler {

    @ExceptionHandler(ActivityCreateException.class)
    @ResponseBody
    public String activityCreateException(Exception e){
        String msg=e.getMessage();
        System.out.println(msg);
        return "{\"msg\":\""+msg+"\",\"yesOrNo\":\"no\"}";
    }
}
